# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html

# 设置CMAKE的版本号
cmake_minimum_required(VERSION 3.4.1)

# 设置include文件夹的地址
include_directories(
                    src/main/cpp/include/opencv
                    src/main/cpp/include/jsoncpp
                    src/main/cpp/include/magick
                    src/main/cpp/include/mingxing
                 )

# 设置opencv的动态库
add_library(libopencv_java3 SHARED IMPORTED)
set_target_properties(libopencv_java3 PROPERTIES IMPORTED_LOCATION
  ${CMAKE_SOURCE_DIR}/src/main/jniLibs/libs/${ANDROID_ABI}/libopencv_java3.so)

add_library(curl STATIC IMPORTED)
set_target_properties(curl
  PROPERTIES IMPORTED_LOCATION
  ${CMAKE_SOURCE_DIR}/src/main/jniLibs/libs/${ANDROID_ABI}/libmagick.a)

add_library(jsoncpp STATIC IMPORTED)
set_target_properties(jsoncpp
  PROPERTIES IMPORTED_LOCATION
  ${CMAKE_SOURCE_DIR}/src/main/jniLibs/libs/${ANDROID_ABI}/libjsoncpp.a)

add_library( # Sets the name of the library.
             mingxin_lib

             # Sets the library as a shared library.
             SHARED

             # Provides a relative path to your source file(s).
   	         src/main/cpp/mingxin/fileutil.cpp
             src/main/cpp/mingxin/stringutil.cpp
             src/main/cpp/mingxin/JniUtils.cpp
             src/main/cpp/mingxin/magick_task.cpp
             src/main/cpp/mingxin/MD5.cpp
             src/main/cpp/mingxin/AES.cpp
             src/main/cpp/mingxin/License.cpp
             src/main/cpp/mingxin/mingxin.cpp
             src/main/cpp/FaceRecongnizer_jni.cpp
	     )

find_library( # Sets the name of the path variable.
              log-lib

              # Specifies the name of the NDK library that
              # you want CMake to locate.
              log )

target_link_libraries( # Specifies the target library.
                       mingxin_lib
                       libopencv_java3
                       # Links the target library to the log library
                       # included in the NDK.
                       jsoncpp
                       curl

                       ${log-lib} )